﻿using System.Text;

namespace msilgc.cbuilder.CSyntaxTree
{
    internal class NegationStatement : ICStatementWithAssignment
    {
        private readonly IVariable _source;

        public IVariable Target { get; set; }
        public bool OnStack { get; set; }

        public NegationStatement(IVariable target, IVariable source)
        {
            Target = target;
            _source = source;
            OnStack = true;
        }

        public void Emit(StringBuilder builder)
        {
            Target.Emit(builder);
            builder.Append(" = (-1) * ");
            _source.Emit(builder);
            builder.AppendLine(";");
        }
    }
}
